import http from '../http.js'
//可以书写类似于这样的接口了，直接用/api链接地址应该就可以

// 注册获取短信验证码
export function getCode(mobile){
    const url=`/api/short-message/vcode/${mobile}`
    // debugger
    return http.get(url)
}
// 用户注册
export function getRegistry(formData){
    const url = `/api/registry`

    return http.post(url,formData)
}
// 用户登录
export function getLogin(formData){
    const url=`/api/login`
    return http.post(url,formData)
}
//忘记密码/api/password/forget
// export function getLogin(formData){
//     const url=`/api/password/forget`
//     return http.post(url,formData)
// }
// 用户退出登录
export function logOut(){
    const url=`/api/logout`
    return http.get(url)
}
// 查看用户信息
export function getPersonInformation(){
    const url=`/api/login-user/info`
    return http.get(url)
}
// 修改个人信息
export function changePersonalInfor(formData){
    const url=`/api/system/user/profile/update`
    return http.post(url,formData)
}
//上传图片
export function uploadImg(formData){
    const url = `/api/nos/upload/image`
    return http.post(url,formData)
}
// 修改头像
export function changeAvtar(formData){
    const url = `/api/system/user/profile/update/avatar/nos`
    debugger
    return http.post(url,formData)
}
// 我的订单列表
export function getMyGoodsList(formData){
    const url=`/api/shop/shopOrder/site/login-user/list`
    return http.post(url,formData)
}

// 获取栏目
export function getCategory(){
    return http.post("/api/shop/shopCategory/open/list")
}

// 获取商品列表
export function getGoodsList(categoryId){
    const formData = new FormData()
    formData.append("categoryId",categoryId)
    return http.post("/api/shop/shopGoods/open/list",formData)
}
//瀑布流，首页
export  function shopList(pageNum,pageSize,name){
    const formData=new FormData();
    formData.append("pageNum",pageNum);
    formData.append("pageSize",pageSize);
    if (name)
        formData.append("name",name);
    return http.post('api/shop/shopGoods/open/list',formData)
}
// 搜索页面的搜索发现
export function shopSearchList(pageNum,pageSize,name){
    const formData = new FormData();
        formData.append('pageNum', pageNum)
        formData.append('pageSize', pageSize)
        formData.append('name', name)
    const url=`/api/shop/shopGoods/open/list`
    return http.post(url,formData)
}
export function getGoodsDetail(goodsId){
   
    return http.get(`/api/shop/shopGoods/open/detail/${goodsId}`)
}
//瀑布流，今日爆款
export function todayHotList(pageNum,pageSize,name){
    const formData=new FormData();
    formData.append("pageNum",pageNum);
    formData.append("pageSize",pageSize);
    if (name)
        formData.append("name",name);
    return http.post('/api/shop/shopGoods/open/hot/list',formData)
}
//瀑布流，我的咸鱼
export function myFishList(pageNum,pageSize,name){
    const formData=new FormData();
    formData.append("pageNum",pageNum);
    formData.append("pageSize",pageSize);
    if (name)
        formData.append("name",name);
    return http.post('/api/shop/shopGoods/open/used/list',formData)
}
//瀑布流，推荐商品
export function recList(pageNum,pageSize,name){
    const formData=new FormData();
    formData.append("pageNum",pageNum);
    formData.append("pageSize",pageSize);
    if (name)
        formData.append("name",name);
    return http.post('/api/shop/shopGoods/open/recommend/list',formData)
}

